package com.huobao.yunying.adapters;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

public class ViewPagerAdapter extends PagerAdapter {
	
	private List<View> viewList;
	
	public ViewPagerAdapter(List<View> viewList) {
		this.viewList=viewList;
	}

	public int getCount() {
		return viewList.size();
	}

	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0==arg1;
	}
	
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(viewList.get(position));    
		return viewList.get(position);    
	}
	
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(viewList.get(position));  
	}
}
